home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / WMS.CAB / admin.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  7.0 KB  |  209 lines

  1. ∩╗┐<%@ Language=VBScript CODEPAGE=65001 ENABLESESSIONSTATE="True" %>
  2. <!--#include file="include/wmsLocStrings.inc"-->
  3. <!--#include file="include/wmsConstants.inc"-->
  4. <!--#include file="include/wmsCommon.inc"-->
  5. <!--#include file="include/wmsServerHash.inc"-->
  6. <!--#include file="include/wmsconnect.inc"-->
  7. <!--#include file="include/wmsRefresh.inc"-->
  8. <!--#include file="include/wmsHeader.inc"-->
  9. <%
  10. '+-------------------------------------------------------------------------
  11. '
  12. '  Microsoft Windows Media
  13. '  Copyright (C) Microsoft Corporation. All rights reserved.
  14. '
  15. '  File:       Admin.asp
  16. '
  17. '  Contents:    Frame parent per server administration
  18. '
  19. '--------------------------------------------------------------------------
  20.  
  21. on error resume next
  22. Session.LCID = L_LOCALELCID_TEXT
  23.  
  24. Dim bContinue
  25. Dim strServerOp
  26. Dim bPerformInitialization
  27. Dim strShowSLArg
  28.  
  29. bContinue = TRUE
  30. strServerOp = ""
  31. bPerformInitialization = FALSE
  32. strShowSLArg = RemoveDangerousCharacters( trim( qs( "showSL" ) ) )
  33.  
  34. '///////////////////////////////////////////////////////////////////////
  35. '
  36. '  This can be entered if the user retrogrades to default.asp and chooses
  37. '   to admin only the localhost after initially opting to admin from a 
  38. '   server list
  39. '
  40. Sub InitSessionLocalhostOnly()
  41.     ' Convenient place to call this
  42.  
  43.     Session( "Initialized" ) = TRUE
  44.     SyncWithApplicationState
  45.  
  46.     Dim strServerName
  47.     strServerName = RemoveDangerousCharacters( trim( qs( "srv" ) ) )
  48.     ' ensure the name isn't too long
  49.     if( ( 0 < Len( strServerName ) ) and ( MAX_LEN_SERVERNAME >= Len( strServerName ) ) ) then
  50.         g_strQueryStringServer = ServerNameToHashKey( strServerName, TRUE )
  51.     else
  52.         Session( "TransferFromAdmin" ) = TRUE
  53.         Server.Transfer( "include/server_stopped.asp" )
  54.     end if
  55.  
  56.     Session( "Initialized" ) = TRUE
  57.     Session( "ShowServerList" ) = FALSE
  58.     Session( "LocalHostWinName" ) = g_strQueryStringServer
  59.  
  60.     if( 0 < Len( strServerName ) ) then
  61.         if( 0 < Len( strShowSLArg ) ) then
  62.             Response.Redirect( "admin.asp?server=" & g_strQueryStringServer & "&informHostWin=true" )
  63.         else
  64.             Response.Redirect( "admin.asp?server=" & g_strQueryStringServer )
  65.         end if
  66.         
  67.         ' Clean up
  68.         WMSServerHashASPCleanup
  69.         WMSConnectASPCleanup
  70.         
  71.         Response.Flush
  72.     end if
  73.     strServerName = nothing
  74. End Sub
  75.  
  76. '/////////////////////////////////////////////////////////////////////////////////////
  77. Function ServerIsStarted()
  78.  
  79.     if ( TRUE = Session( "ConnectionFailure" ) ) then
  80.         ServerIsStarted = FALSE
  81.         Exit Function
  82.     end if
  83.  
  84.     Dim bContinue
  85.     bContinue = TRUE
  86.     strServerOp = RemoveDangerousCharacters( trim( qs( "serverOp" ) ) )
  87.     ConnectToServer
  88.     if( WMS_SERVICE_STARTED = g_dwConnectionFailureCode ) then
  89.         bContinue = TRUE
  90.     elseif( WMS_SERVICE_STOPPED = g_dwConnectionFailureCode ) then
  91.         bContinue = FALSE
  92.     elseif( IsEmpty( g_objServer ) ) then
  93.         if( ( WMS_SERVER_UNKNOWN = g_dwConnectionFailureCode ) or ( WMS_HOST_UNAVAILABLE = g_dwConnectionFailureCode ) or _
  94.             ( WMS_SERVICE_UNAVAILABLE = g_dwConnectionFailureCode ) ) then
  95.             Session( "ConnectionFailure" ) = TRUE
  96.             bContinue = FALSE
  97.         else
  98.             bContinue = FALSE
  99.         end if
  100.     end if
  101.  
  102.     if( 0 = StrComp( "kill", strServerOp, vbTextCompare ) ) then
  103.         Session( "ConnectionFailure" ) = TRUE
  104.         bContinue = FALSE
  105.     end if
  106.  
  107.     ServerIsStarted = bContinue
  108. End Function
  109.  
  110.  
  111. '/////////////////////////////////////////////////////////////////////////////////////
  112. '
  113. ' Process the query string and initialize the session if necessary
  114. '
  115. '/////////////////////////////////////////////////////////////////////////////////////
  116. if( FALSE = Session( "Initialized" ) ) then
  117.     bPerformInitialization = TRUE
  118. elseif( 0 < Len( RemoveDangerousCharacters( trim( qs( "srv" ) ) ) ) ) then
  119.     '
  120.     ' The Windows Media Encoder Admin UI may call us, in which case we're being entered from 
  121.     '  somewhere beyond the serverlist page; therefore, we must hash the servername and use it.
  122.     '
  123.     bPerformInitialization = TRUE
  124. elseif( 0 < Len( strShowSLArg ) ) then
  125.     if( ( 0 = StrComp( "false", strShowSLArg, vbTextCompare ) ) and ( TRUE = Session( "ShowServerList" ) ) ) then
  126.         bPerformInitialization = TRUE
  127.     end if
  128. end if
  129.  
  130. if( bPerformInitialization ) then
  131.     InitSessionLocalhostOnly
  132. end if
  133.  
  134. BrowserSniff
  135. PickStyleSheet
  136. RedirectIfLegacyBrowser
  137.  
  138. if( 0 = Len( CStr( Session( "BaseHREF" ) ) ) ) then
  139.     Session( "BaseHREF" ) = Request.ServerVariables( "HTTP_HOST" )
  140. end if
  141.  
  142. bContinue = ServerIsStarted()
  143.  
  144. if( FALSE = bContinue ) then
  145.     Session( "TransferFromAdmin" ) = TRUE
  146.     Server.Transfer( "include/server_stopped.asp" )
  147. end if
  148.  
  149.  
  150. '/////////////////////////////////////////////////////////////////////////////////////
  151. '
  152. '  Generate the frameset
  153. '
  154. '/////////////////////////////////////////////////////////////////////////////////////
  155. WriteHTMLFramesetHeader %>
  156. <title>
  157.     <%= Server.HTMLEncode( L_ASPADMINDESCRIPTION_TEXT ) & " : " & Server.HTMLEncode( g_strServerName ) %>
  158. </title>
  159. <% 
  160.     if brMSIE = g_dwBrowserType then %>
  161. <script language="JavaScript">
  162. <!--
  163. <%
  164. '//
  165. '// This code serves as a semaphore so that the right-hand pane won't try
  166. '//  to set the tree state (highlighted node) until the treeview pane has 
  167. '//  finished loading.  Its onLoad event handler will invoke SetTreeReady.
  168. '//  The right-hand pane will wait until this flag is set via periodic 
  169. '//  calls to IsTreeReady() before telling it which node is active.
  170. '//
  171. %>
  172. var g_bTreeReady = false;
  173.  
  174. function SetTreeReady()
  175. {
  176.     g_bTreeReady = true;
  177. }
  178.  
  179. function IsTreeReady()
  180. {
  181.     return( g_bTreeReady );
  182. }
  183. -->
  184. </script>
  185. <% 
  186.     end if %>
  187.     <frameset rows="*,30" frameborder="0" framespacing="0">
  188.         <frameset cols="230,*" border=1 framespacing=1 frameborder=1>
  189.             <frame name="treeFrames" src="treeframes.asp?server=<%= g_strQueryStringServer %>" frameborder="yes" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0" framespacing="0" scrolling="auto">
  190.             <frame name="frameDetails" src="pages/server.asp?server=<%= g_strQueryStringServer %>" frameborder="0" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0" framespacing="0" scrolling="auto">
  191.     </frameset>
  192.     <frame name="WMSSession" src="WMSSession.asp?server=<%= g_strQueryStringServer %>&informHostWin=<%= RemoveDangerousCharacters( Left( trim( qs( "informHostWin" ) ), 3 ) ) %>" noresize frameborder="no" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0" framespacing="0" scrolling="no">
  193.             
  194.     <noframes>
  195.     <body oncontextmenu="JavaScript:return true;event.cancelBubble=true;return false;">
  196.         <p>
  197.         <%= Server.HTMLEncode( L_NOFRAMESUPPORT_TEXT ) %>
  198.         <p>
  199.     </body>
  200.     </noframes>
  201.  
  202.     </frameset>
  203. </html>
  204. <% 
  205. ' Clean up
  206. on error resume next
  207. WMSServerHashASPCleanup
  208. WMSConnectASPCleanup
  209. %>